Skip to content

extraneous hidden authorid in deletion POST method #39601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Tech-Risk-Chris opened this issue May 21, 2025 · 0 comments
Open

extraneous hidden authorid in deletion POST method #39601

Tech-Risk-Chris opened this issue May 21, 2025 · 0 comments
Labels
Content:Learn:Express Learning area Express docs goal: consistency (Experimental label) Issues about inconsistent/conflicting/contradictory content. needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.

Comments

@Tech-Risk-Chris
Copy link

MDN URL

https://developer.mozilla.org/en-US/docs/Learn_web_development/Extensions/Server-side/Express_Nodejs/forms/Delete_author_form

What specific section or headline is this issue about?

PUG View and Controller-post route

What information was incorrect, unhelpful, or incomplete?

The code in author_delete_post() switches from using req.params.id in the book-list analysis to using req.body.authorid in the final deletion step, but that's unnecessary, due to the way the URL is constructed.

GET /catalog/author/682dc761c51f74371620d3b6 200 26.154 ms - 1694
GET /stylesheets/style.css 304 2.096 ms - -
GET /catalog/author/682dc761c51f74371620d3b6/delete 200 21.471 ms - 1694
GET /stylesheets/style.css 304 0.540 ms - -
POST /catalog/author/682dc761c51f74371620d3b6/delete 302 11.400 ms - 45
GET /catalog/authors 304 18.164 ms - -

in fact the entire hidden parameter in the author_delete.pug form seems unnecessary. Perhaps an artifact from a previous version?

What did you expect to see?

In the PUG view, I expected

    form(method='POST')
      button.btn.btn-primary(type='submit') Delete

and in the authors controller implementation of author_delete_post,

    // Author has no books. Delete object and redirect to the list of authors.
    await Author.findByIdAndDelete(req.params.id);
    res.redirect("/catalog/authors");

Do you have any supporting links, references, or citations?

no

Do you have anything more you want to share?

no

MDN metadata

Page report details
@Tech-Risk-Chris Tech-Risk-Chris added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label May 21, 2025
@github-actions github-actions bot added the Content:Learn Learning area docs label May 21, 2025
@Josh-Cena Josh-Cena added Content:Learn:Express Learning area Express docs and removed Content:Learn Learning area docs labels May 21, 2025
@caugner caugner added the goal: consistency (Experimental label) Issues about inconsistent/conflicting/contradictory content. label May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Learn:Express Learning area Express docs goal: consistency (Experimental label) Issues about inconsistent/conflicting/contradictory content. needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.
Projects
None yet
Development

No branches or pull requests

3 participants